//
//  WSSignItemCell.m
//  CharonTVProject
//
//  Created by karong on 2023/7/31.
//

#import "WSSignItemCell.h"
#import "WSSign.h"
#import "WSVerticalGradientColorView.h"

@interface WSSignItemCell ()
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UILabel *dayLabel;
@property (weak, nonatomic) IBOutlet WSVerticalGradientColorView *bgView;

@end

@implementation WSSignItemCell

- (void)setDataWithObject:(WSSign *)object day:(NSInteger)day {
    self.dayLabel.text = WSSF(@"%@%ld%@", APPLocalized(@"第"),(long) object.charonTV_days,APPLocalized(@"天"));
    [self setMainViewWithObject:object day:day];
    [self setRewardWithObject:object];
}

- (void)setMainViewWithObject:(WSSign *)object day:(NSInteger)day {
    UIColor * color1 = [UIColor colorFromHexRGB:@"FAECDA"];
    UIColor * color2 = [UIColor colorFromHexRGB:@"FEFEFC"];
    UIColor * dayColor = [UIColor colorFromHexRGB:@"333333"];
    UIColor * coinsColor = [UIColor colorFromHexRGB:@"F23735"];
    if (object.charonTV_days <= day) {
        color1 = [UIColor colorFromHexRGB:@"F9661A"];
        color2 = [UIColor colorFromHexRGB:@"DD2D08"];
        dayColor = UIColor.font_white_ffffff;
        coinsColor = UIColor.font_white_ffffff;
    }
    [self.bgView resetCorlor1:color1 color2:color2];
    self.dayLabel.textColor = dayColor;
    self.titleLabel.textColor = coinsColor;
}

- (void)setRewardWithObject:(WSSign *)object {
    NSString * imageStr = @"";
    NSString * text = @"";
    if (object.charonTV_type == 1) {
        imageStr = @"icon_jinbi";
        text = WSSF(@"+%ld", (long)object.charonTV_coins);
    }
    else {
        imageStr = @"icon_vip2";
        text = WSSF(@"+%ld%@", (long)object.charonTV_vip_day,APPLocalized(@"天"));
    }
    self.titleLabel.text = text;
}
@end
